using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace RhythmComet.Services
{
    public class Camera
    {
        private Game game;
        private float aspectRatio;
        public Vector3 Target;
        public Vector3 Position;
        public Vector3 UpVector;
        public Matrix World;
        public Matrix View;
        public Matrix Projection;

        public Camera(Game game, Vector3 target, Vector3 position, Vector3 upVector, float aspectRatio)
        {
            this.game = game;
            this.aspectRatio = aspectRatio;
            Target = target;
            Position = position;
            UpVector = upVector;

            Initialize();
        }

        public void Initialize()
        {
            float viewAngle = MathHelper.PiOver4;
            float nearPlane = 0.1f;
            float farPlane = 500.0f;

            Projection = Matrix.CreatePerspectiveFieldOfView(viewAngle, aspectRatio, nearPlane, farPlane);
            View = Matrix.CreateLookAt(Position, Target, UpVector);
        }
    }
}
